package com.longge;

import java.util.HashSet;
import java.util.Set;

public class NumUniqueEmails {

    public int numUniqueEmails(String[] emails) {

        Set<String> set = new HashSet<>();
        for (String email : emails) {
            String[] subEmails = email.split("@");
            String subEmailOne = subEmails[0];
            String subEmailTwo = subEmails[1];
            String[] split = subEmailOne.replace(".", "").split("\\+");
            set.add(split[0] + "@" + subEmailTwo);
        }
        return set.size();
    }
}
